package org.zhxy.zhxy.controller.front;



import org.apache.commons.math3.analysis.function.Add;
import org.zhxy.zhxy.entity.RoomComment;
import org.zhxy.zhxy.entity.dto.AddRoomCommentDto;
import org.zhxy.zhxy.service.RoomCommentService;
import org.springframework.web.bind.annotation.*;
import org.zhxy.zhxy.utils.Result;

import javax.annotation.Resource;
import java.util.List;

/**
 * 教室评价(RoomComment)表控制层
 *
 * @author yayong
 * @since 2024-10-19 21:51:08
 */
@RestController
@RequestMapping("/api/roomComment")
public class RoomCommentController {

/**
 * 服务对象
 */
@Resource
private RoomCommentService roomCommentService;


/**
 * 新增评论
 *
 */
@PostMapping("/add-room-comment")
public Result addRoomComment(@RequestBody AddRoomCommentDto addRoomCommentDto) {
    roomCommentService.addRoomComment(addRoomCommentDto);
    return Result.success();
}

/**
 * 获取某个教室的评论
 *
 */
@GetMapping("/get-room-comment")
public Result getRoomComment(@RequestParam("roomId") Integer roomId) {
    List<RoomComment>  res = roomCommentService.getRoomComment(roomId);
    return Result.success(res);
}
}

